package com.hansming.bss.modules.sfc.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hansming.bss.common.service.CrudService;
import com.hansming.bss.modules.sfc.dao.TravellerDao;
import com.hansming.bss.modules.sfc.entity.Traveller;

/**
 * 游客信息Service
 * @author Hansming
 * @version 2017-11-04
 */
@Service
@Transactional(readOnly = true)
public class TravellerService extends CrudService<TravellerDao,Traveller>{
	
	@Autowired
	private TravellerDao travellerDao;
	
	//根据订单id查找所包含的游客信息
	@Transactional(readOnly = false)
	public	List<Traveller> findTravellersByOrderId(String id){
		return travellerDao.findTravellersByOrderId(id);
	}
	
	public List<Traveller> getTravelelrsByCustomerid(String id){
		return travellerDao.getTravelelrsByCustomerid(id);
	}
	
	//可固定ID存储游客
	@Transactional(readOnly = false)
	public void saveTraveller(Traveller traveller){
		travellerDao.saveTraveller(traveller);
	}
	
	
	//存到sfc_order_traveller表中
	@Transactional(readOnly = false)
	public void saveTraveInOrder(String id,String type,String orderid){
		travellerDao.saveTraveInOrder(id, type,orderid);
	}
	
	//更新游客信息
	@Transactional(readOnly = false)
		public void updatetraveller(Traveller traveller){
		travellerDao.updatetraveller(traveller);
	}
	
	public		List<Traveller>		getTravellersByUseridlimit4(String id){
		return travellerDao.getTravellersByUseridlimit4(id);
	}
	
	//pc端根据用户token查找所有traveller信息
	public List<Traveller> selectTravellerByToken(String token){
		return travellerDao.selectTravellerByToken(token);
	}	
	
	//pc端新增游客
	@Transactional(readOnly = false)
	public void insertTravellerPcNew(Traveller traveller) {
		travellerDao.insertTravellerPcNew(traveller);
	}
	
	//pc端更新游客信息
	@Transactional(readOnly = false)
	public void pcupdatetraveller(Traveller traveller) {
		travellerDao.pcupdatetraveller(traveller);
	}
}
